<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGroupPostTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('group_post', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->index()->comment('用户id');
            $table->integer('group_id')->index()->comment('群组id');
            $table->string('title')->comment('标题');
            $table->text('content')->comment('内容');
            $table->boolean('status')->comment('状态');
            $table->integer('last_reply_time')->comment('上次回复时间');
            $table->integer('view_count')->comment('查看量');
            $table->integer('reply_count')->comment('回复量');
            $table->boolean('is_top')->comment('是否置顶');
            $table->integer('cate_id')->comment('分类id');
            $table->string('summary')->comment('简介');
            $table->string('cover')->comment('封面')->nullable();
            $table->json('images')->comment('图片组')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('group_post');
    }
}
